package com.liujing.chapter5;

/**
 * The s1 field is initialized before the constructor is entered; technically, so is the
 * s2 field, which is set to null as the object is created. The more flexible s2 field
 * lets you choose what value to give it when you call the constructor, whereas s1
 * always has the same value.
 */
public class Exercise_5_2 {
    String s1 = "s1";
    String s2;

    Exercise_5_2(String s2) {
        this.s2 = s2;
    }

    public static void main(String[] args) {
        Exercise_5_2 exercise52 = new Exercise_5_2("s2");
        System.out.println("s1: " + exercise52.s1);
        System.out.println("s2: " + exercise52.s2);
    }
}
